<template>
  <el-container>
    <!-- <el-header>
       <el-button @click="$router.push('/foodSafety/archives/archives')"    style="margin-right: 20px" icon="el-icon-back" type="primary"
            >返回上一页</el-button
          >
          <rz-height></rz-height>
      <div class="title">
        {{data.operAtorName||data.unitname}}
      </div>
      <rz-height></rz-height>
      <el-row :gutter="20">
        <el-col :span="6">统一社会信用代码:{{data.identify}}</el-col>
        <el-col :span="6" v-if="data.newlicenseno">许可证编号:{{data.newlicenseno}}</el-col>
      </el-row>
      <rz-height></rz-height>
      <el-row>
        <el-col :span="24">地址:{{data.productionAddress||data.address}}</el-col>
      </el-row>
    </el-header>
     <el-header> -->

    <div class="Jump">
      <el-button
        @click="$router.push('/chainIndex')"
        style="margin-right: 20px"
        icon="el-icon-back"
        type="primary"
        >返回上一页</el-button
      >
    </div>
    <el-header>
      <rz-height></rz-height>
      <div class="title_wapper">
        <!-- <el-progress :width="100" :stroke-width="12" color="#fff" type="circle" :format="()=>data.indexScore||0" :percentage="data.indexScore||0"></el-progress> -->
        <div class="title_right">
          <div class="title">
            {{ data.brandName || data.unitName }}
          </div>
          <rz-height></rz-height>
          <div style="display: flex; align-items: center">
            <el-tag
              >{{ data.provinceName }}-{{ data.cityName }}-{{
                data.districtName
              }}</el-tag
            >
            <div>负责人信息：{{ data.userName }}({{ data.userTelTrue }})</div>
          </div>
        </div>
      </div>

      <!--  -->

      <rz-height></rz-height>
      <el-row :gutter="20">
        <el-col :span="8">统一社会信用代码：{{ data.identify }}</el-col>
        <el-col :span="12">营业执照名称：{{ data.unitName }} </el-col>
      </el-row>
      <!-- <rz-height></rz-height> -->

      <!-- <el-row :gutter="20">
        <el-col :span="8" v-if="data.newlicenseno">许可证编号：{{ data.newlicenseno }}</el-col>
        <el-col :span="12">经营者名称：{{data.operAtorName}}</el-col>
      </el-row> -->
      <rz-height></rz-height>
      <rz-height></rz-height>
      <el-row :gutter="20">
        <el-col :span="8">注册日期：{{ data.createDateTimeStr }}</el-col>
        <el-col :span="12"
          >地址：{{ data.productionAddress || data.address }}</el-col
        >
      </el-row>
      <div class="qr_code">
        <vue-qr
          :text="url"
          ref="Qrcode"
          :margin="0"
          :logoScale="0.3"
          :size="90"
        ></vue-qr>

        <el-button @click="getQrCode()" size="mini" style="margin-top: 10px"
          >下载食安码</el-button
        >
      </div>
    </el-header>
    <el-container class="content">
      <el-aside width="200px">
        <el-menu
          :default-active="defaultActive"
          class="el-menu-vertical-demo"
          router
        >
          <el-menu-item
            :index="`${item.route}`"
            v-for="item in list"
            :key="item.id"
          >
            <span slot="title">{{ item.title }}</span>
          </el-menu-item>
          <!-- <el-menu-item index="2">
            <span slot="title">安全事故</span>
          </el-menu-item> -->
          <!-- <el-menu-item index="2">
            <span slot="title">主体责任</span>
          </el-menu-item>
          <el-menu-item index="2">
            <span slot="title">投诉举报</span>
          </el-menu-item>
          <el-menu-item index="2">
            <span slot="title">监督执法</span>
          </el-menu-item>
          <el-menu-item index="2">
            <span slot="title">食品抽检</span>
          </el-menu-item> -->
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import { findResponseByIdIndex } from "@/api/modules/chain";
import vueQr from "vue-qr";
export default {
  components: {
    vueQr,
  },
  // props:[],
  // 页面加载
  created() {
    if (this.$route.query.id) {
      sessionStorage.setItem("chainId", this.$route.query.id);
      this.url= `https://spaq.suzhou.gov.cn/ssa-publicity/#/chainStore?id=${this.$route.query.id}`
    }
   if(this.$route.query.route){
        this.defaultActive=this.$route.query.route
   }
    this.getCompanyMainPageInfo();
  },
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {
      url: `https://spaq.suzhou.gov.cn/ssa-publicity/#/chainStore?id=${sessionStorage.getItem(
        "chainId"
      )}`,
      list: [
        {
          title: "综合分析",
          id: 10,
          route: "/chain/analysis",
        },
        // {
        //   title: "索证索票",
        //   id: 11,
        //   route: "/chain/ticketClaim",
        // },
        {
          title: "单位管理",
          id: 0,
          route: "/chain/businessUnit",
        },
        {
          title: "制度管理",
          id: 1,
          route: "/chain/system",
        },
        // {
        //   title: "会议管理",
        //   id: 2,
        //   route: "/chain/meeting",
        // },
        {
          title: "会议和培训",
          id: 3,
          route: "/chain/conferenceTraining",
        },
        // {
        //   title: "检查台账",
        //   id: 4,
        //   route: "/chain/checkAccount",
        // },
        {
          title: "对象自查",
          id: 5,
          route: "/chain/regularInspection",
        },
        {
          title: "自检管理",
          id: 6,
          route: "/chain/quickInspection",
        },
        // {
        //   title: "成员架构",
        //   id: 7,
        //   route: "/chain/member",
        // },
        {
          title: "应急管理",
          id: 8,
          route: "/chain/emergency",
        },
        // {
        //   title: "社会责任",
        //   id: 9,
        //   route: "/chain/publicity",
        // },

        {
          title: "管理架构",
          id: 11,
          route: "/chain/framework",
        },
        {
          title: "责任任命",
          id: 12,
          route: "/chain/responsibility",
        },
         {
          title: "三件事",
          id: 13,
          route: "/chain/inspect",
        },
      ],
      defaultActive: "/chain/analysis",
      data: {},
    };
  },
  // 方法
  methods: {
    getCompanyMainPageInfo() {
      findResponseByIdIndex({
        params: {
          id: sessionStorage.getItem("chainId"),
        },
      }).then((res) => {
        // sessionStorage.setItem("unitName",res.data.unitName)
        this.data = res.data;

        // if (
        //   !this.list.some((x) => x.id == 111) &&
        //   res.data.purchaseName == "总部"
        // ) {
        //   this.list.splice(1, 0, {
        //     title: "索证索票",
        //     id: 111,
        //     route: "/chain/ticketClaim",
        //   });
        // }
      });
    },
    format() {
      return;
    },
  },
  // 监听属性
  watch: {},
  // 组件
  // 计算属性
  computed: {},
};
</script>

<style lang="scss" scoped>
.el-container {
  height: calc(100% - 130px);

  .el-header {
    padding: 20px;
    height: auto !important;
    background: $default;
    color: #ffffff;
    // background-image: linear-gradient(to right, #72BBFF , #1D92FF);
    .title_wapper {
      display: flex;
      .title {
        font-size: 25px;
        font-weight: 700;
      }

      .el-tag {
        margin-right: 10px;
      }
      .title_right {
        display: flex;
        justify-content: space-between;
        flex-direction: column;
      }
      /deep/ .el-progress__text {
        font-size: 18px !important;
        color: #ffff;
      }
    }
    .qr_code {
      position: absolute;
      right: 20%;
      top: 10%;
      display: flex;
      flex-direction: column;
    }
  }
  .Jump {
    padding: 10px;
    background: #2e40d1;
  }
  .el-aside {
    height: 100% !important;
    /deep/ .el-menu {
      border-right: none;
    }
  }

  .el-main {
    background-color: #f2f2f2;
    // height: 100%;
  }
}
// .content{
//   height:calc(100% - 120px);
// }
</style>